<?php $this->extend('comm/page');?>

<?php $this->block('css'); ?>
<style>
.not-data{display:block;margin:98;width:100%;color:#666;}
.asset-content{margin-right:-6px;margin-left:-6px;}
.row-flex{display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row;}
.row-flex .card{padding:0 6px 10px;}
.row-flex .card .img-card{position:relative;overflow:hidden;padding:8px;height:100%;border:1px solid #ccc;border-radius:4px;}
.row-flex .card .img-card .link{display:block;overflow:hidden;margin-bottom:150px;border-radius:3px;}
.row-flex .card .img-card .info{position:absolute;right:0;bottom:0;left:0;display:block;padding:8px;font-size:14px;}
.row-flex .card .img-card .info p{margin-bottom: 1px; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.row-flex .card .img-card .info .oper{display:flex;padding-top:4px;justify-content:space-between;}
.row-flex .card .img-card .info .oper .idx{display:inline-block;font-size:1pc;line-height:24px;}
.row-flex .card .img-card .info .oper .btn{display:inline-block;padding:2px 5px;border:1px solid #2d8cf0;border-radius:4px;line-height:20px;}
</style>
<?php $this->blockEnd(); ?>

<div class="panel panel-default panel-intro">
    <?php echo $this->build_heading(); ?>

    <div class="panel-body">
        <!-- 搜索 -->
        <div id="search" class="row">
            <form class="layui-form" lay-filter="search">
                <div class="col-xs12 col-sm-6 col-md-3">
                    <div class="layui-form-item">
                        <label class="layui-form-label mg-label">标题:</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" placeholder="标题" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="col-xs12 col-sm-6 col-md-3">
                    <div class="layui-form-item">
                        <label class="layui-form-label mg-label">存储类型:</label>
                        <div class="layui-input-block">
                            <select name="storage" lay-filter="storage">
                                <option value=""></option>
                                <?php foreach($storage as $k => $v):?>
                                <option value="<?php echo $k; ?>"><?php echo $v; ?></option>
                                <?php endforeach;?>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="col-xs12 col-sm-6 col-md-3">
                    <div class="layui-form-item">
                        <label class="layui-form-label mg-label">开放状态:</label>
                        <div class="layui-input-block">
                            <select name="status" lay-filter="status">
                                <option value=""></option>
                                <?php foreach($status as $k => $v):?>
                                <option value="<?php echo $k; ?>"><?php echo $v; ?></option>
                                <?php endforeach;?>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="col-xs12 col-sm-6 col-md-3 hidden-xs">
                    <div class="layui-form-item">
                        <label class="layui-form-label mg-label">修改时间:</label>
                        <div class="layui-input-block">
                            <input type="text" name="update_time" class="layui-input date-range">
                        </div>
                    </div>
                </div>
            </form>
        </div>

        <div id="toolbar" class="toolbar">
            <?php echo $this->build_toolbar(['refresh', 'add', 'search']); ?>
        </div>

        <div class="asset-content">
            <div class="row-flex mr-t-xs" id="card-list"></div>
            <!-- 分页 -->
            <div id="page" class="mr-xs"></div>
        </div>
    </div>
</div>

<script type="text/html" id="cart-item">
    {{# for(var i in d){ var item = d[i]; }}
    <div class="card col-xs-6 col-sm-3 col-md-2 col-lg-1-5">
        <div class="img-card">
            <a href="{{item.url}}" target="_blank" class="link">
                <img class="img-responsive img-center" src="{{item.url}}" title="{{item.title}}" alt="{{item.title}}"/>
            </a>
            <div class="info">
                <p title="{{item.title}}">
                    <strong>资源标题: </strong>
                    <span>{{item.title}}</span>
                </p>
                <p title="{{item.storage_txt}}">
                    <strong>存储引擎: </strong>
                    <span>{{item.storage_txt}}</span>
                </p>
                <p title="{{item.status_txt}}">
                    <strong>开放状态: </strong>
                    <span>{{item.status_txt}}</span>
                </p>
                <p title="{{item.update_time}}">
                    <strong>编辑时间: </strong>
                    <small>{{item.update_time}}</small>
                </p>
                <div class="oper">
                    <strong class="idx">ID.{{item.id}}</strong>
                    <?php if($container->auth->check('/admin/general/assets/edit', $userInfo['id'])): ?>
                    <a href="javascript:void(0);" class="btn btn-edit" data-idx="{{item.id}}">编辑</a>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
    {{# } }}
</script>